home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLGR106.ARJ / GRAPHICS.C < prev    next >
C/C++ Source or Header  |  1991-03-06  |  1KB  |  70 lines

  1. /* This is file GRAPHICS.C */
  2. /*
  3. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  4. **
  5. ** This file is distributed under the terms listed in the document
  6. ** "copying.dj", available from DJ Delorie at the address above.
  7. ** A copy of "copying.dj" should accompany this file; if not, a copy
  8. ** should be available from where this file was obtained.  This file
  9. ** may not be distributed without a verbatim copy of "copying.dj".
  10. **
  11. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  12. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. */
  14.  
  15. #include "sys/registers.h"
  16.  
  17. unsigned _GrMaxX;
  18. unsigned _GrMaxY;
  19. unsigned _GrSizeX;
  20. unsigned _GrSizeY;
  21.  
  22. GrPlot(x, y, c)
  23. {
  24.   register unsigned char *a;
  25.   if ((x<0) || (x>_GrMaxX) || (y<0) || (y>_GrMaxY))
  26.     return;
  27.   a = (unsigned char *)(0xd0000000+((x+y*_GrSizeX)&0xfffff));
  28.   if (c & 0x100)
  29.     *a ^= c;
  30.   else
  31.     *a = c;
  32. }
  33.  
  34. GrPixel(x, y)
  35. {
  36.   if ((x<0) || (x>_GrMaxX) || (y<0) || (y>_GrMaxY))
  37.     return 0;
  38.   return *(unsigned char *)(0xd0000000+((x+y*_GrSizeX)&0xfffff));
  39. }
  40.  
  41. GrPlot3d(x, y, c)
  42. {
  43.   register unsigned char *a;
  44.   if ((x<0) || (x>_GrMaxX) || (y<0) || (y>_GrMaxY))
  45.     return;
  46.   a = (unsigned char *)(0xd0000000+((x+y*_GrSizeX)&0xfffff));
  47.   if ((*a < c) || (c<0xc0))
  48.     *a = c;
  49. }
  50.  
  51. GrMaxX()
  52. {
  53.   return _GrMaxX;
  54. }
  55.  
  56. GrMaxY()
  57. {
  58.   return _GrMaxY;
  59. }
  60.  
  61. GrSizeX()
  62. {
  63.   return _GrSizeX;
  64. }
  65.  
  66. GrSizeY()
  67. {
  68.   return _GrSizeY;
  69. }
  70.